<?php
/* 
* @Author: LDF QQ 47121862
* @Date:   2014-05-13 22:22:14
* @Last Modified by:   LDF QQ 47121862
* @Last Modified time: 2014-06-06 10:51:38
*/
//缓存处理方法
function cache($name, $value = false){
	return F($name,$value,'data/cache');
}

//获得分类url
function getCateUrl($cid){
	$url = __WEB__.'/Index/index/category/cid/'.$cid;
	return $url;
}

//设置属性url
function searchAttrUrl($avid,$index,$title){
	$index--;
	$s=explode('-', Q('s'));
	if($s[$index]==$avid){
		$class='class="act"';
	}
	$s[$index]=$avid;
	$s=implode($s,'-');
	$url = U('category',array('cid'=>Q('cid'),'s'=>$s));
	$url = "<a $class href='{$url}'>$title</a>";
	return $url;

}

//订单状态
function orderStat($arr){
	foreach ($arr as $k => $v) {
		$arr[$k]['stats']=chkOrder($v['stat']);
	}
	return $arr;
}
function chkOrder($id){
	switch ($id) {
		case '1':
			return '<b class="yellow2 p5">等待审核</b>';
		case '2':
			return '<b class="yellow p5">等待付款</b>';
		case '3':
			return '<b class="orange  p5">正在配货</b>';
		case '4':
			return '<b class="green5 p5">已发货</b>';
		case '5':
			return '<b class="white-1 p5">取消</b>';
		case '6':
			return '<b class="teal p5">已送达</b>';
		case '7':
			return '<b class="green  p5">交易完成</b>';
		case '8':
			return '<b class="gray  p5">取消订单</b>';
	}
}